package com.xu.mapper;

import com.xu.pojo.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface OrderMapper {

    List<Order> queryAllOrder();

    //删除订单
    int delOrder(int id);

    //修改订单
    int updOrder(Order order);

    //修改评论状态
    @Update("update bread.order set isEvaluate=#{isEvaluate} where id =#{id}")
    int updOorder(Order order);

    int selectOrderNum();

    //查找指定订单（后台用）
    Order queryOrderById(int pid);

    List<Order> queryOrderByUserId(int userid);

    int addOrder(Order order);

    //查找指定订单（用户用）
    @Select("select * from bread.order join bread.product where order.pid=product.id and order.id=#{id}")
    Order queryOrderByIid(int id);

}
